#ifndef QQTVIRTUALDATASERVERMANAGER_H
#define QQTVIRTUALDATASERVERMANAGER_H

#include <QObject>

#include <qqtdictionary.h>
#include <qqtudpserver.h>
#include <qqtdataprotocol.h>
#include <qqtprotocolmanager.h>

#include <qqtframe.h>

#include <qqthighgrade_global.h>
/**
 * @brief The QQtVirtualDataManager class
 * LibQQt提供的虚拟接口的网络数据管理者
 * SERVER
 */
class QQTHIGHGRADESHARED_EXPORT QQtVirtualDataServerManager : public QObject
{
    Q_OBJECT

public:
    explicit QQtVirtualDataServerManager ( QObject* parent = 0 );
    virtual ~QQtVirtualDataServerManager();

    //!1 子类一般会用来设置handler和使用handler。
    void setServerHandler ( QQtUdpServer* handler );
    QQtUdpServer* handler();

    //设置远端服务器IP、端口，一般在服务器端，这个函数会被忽略掉。
    void setServerAddress ( QHostAddress address, int port = 4420 );
    void setServerPort ( int port = 4420 );

    //客户端要接收数据必须bind端口
    void setListeningAddress ( QHostAddress address, int port = 4419 );
    void setListeningPort ( int port = 4419 );

    //!2
    void setProtocolManagerHandler ( QQtProtocolManager* protoMana );
    QQtProtocolManager* protocolManager();

signals:

protected slots:
    virtual void notifyToUser ( QQtProtocol* protocol, QQtMessage* message );

private slots:
    virtual void remainingProtocolChanged ( int num );
protected:

protected slots:

protected:

private:
    QQtUdpServer* s0;
    QQtProtocolManager* m0;
};

#endif // QQTVIRTUALDATASERVERMANAGER_H

